
import {  ref} from "vue";
const mockData =ref([]);
const tColumnConfig = [
    { prop: "entpname", label: "企业名称", width: "220px" ,isSlot:false},
    { prop: "user_login", label: "账号名称", ruleswidth: "120px" ,isSlot:false},
     { prop: "image", label: "图片数据", ruleswidth: "120px" ,isSlot:true},
    { prop: "user_name", label: "真实姓名", width: "",isSlot:false},
   { prop: "Operations", label: "操作", ruleswidth: "120px",isSlot:true },
]


const slotName=[
    
   { prop: "image", label: "图片数据", ruleswidth: "120px" ,isSlot:true},
   { prop: "Operations", label: "操作", ruleswidth: "120px",isSlot:true },
]

 
// 模拟数据生成函数
async function generateMockData(count = 100) {
  // 公司名称相关词库
  const companyTypes = ['科技', '信息', '网络', '软件', '数据', '智能', '数码', '电子', '创新', '卓越'];
  const companySuffix = ['有限公司', '有限责任公司', '集团', '股份有限公司', '科技有限公司', '信息技术有限公司'];
  const locationPrefix = ['北京', '上海', '深圳', '广州', '杭州', '南京', '成都', '武汉', '西安', '重庆'];
  const industryWords = ['先锋', '卓越', '创新', '智慧', '未来', '顶尖', '核心', '主流', '领先', '优质'];
  
  // 姓氏和名字词库
  const familyNames = ['张', '王', '李', '赵', '陈', '刘', '杨', '黄', '周', '吴', '徐', '孙', '胡', '朱', '高', '林', '何', '郭', '马', '罗'];
  const maleNames = ['伟', '强', '勇', '军', '磊', '超', '鹏', '杰', '斌', '浩', '宇', '晨', '洋', '明', '鑫', '亮', '刚', '健', '波', '平'];
  const femaleNames = ['芳', '娜', '敏', '静', '秀英', '丽', '艳', '娟', '玲', '燕', '慧', '莹', '雪', '梅', '洁', '琳', '丹', '洁', '倩', '婷'];
  
  // 头像图片URL（使用随机头像API）
  const avatarUrls = [
    'https://api.dicebear.com/7.x/avataaars/svg?seed=',
    'https://api.dicebear.com/7.x/micah/svg?seed=',
    'https://api.dicebear.com/7.x/miniavs/svg?seed='
  ];
  
  // 操作按钮配置
  const operationsList = [
    ['查看', '编辑', '删除'],
    ['查看', '编辑'],
    ['查看', '重置密码', '禁用'],
    ['查看', '编辑', '权限管理'],
    ['查看详情', '操作日志']
  ];
  
  const data = [];
  
  for (let i = 1; i <= count; i++) {
    // 生成公司名称
    const location = locationPrefix[Math.floor(Math.random() * locationPrefix.length)];
    const industry = industryWords[Math.floor(Math.random() * industryWords.length)];
    const companyType = companyTypes[Math.floor(Math.random() * companyTypes.length)];
    const suffix = companySuffix[Math.floor(Math.random() * companySuffix.length)];
    const entpname = `${location}${industry}${companyType}${suffix}`;
    
    // 生成账号名称（英文+数字组合）
    const prefix = ['user', 'admin', 'test', 'demo', 'work', 'office', 'sys', 'dev', 'operator', 'manager'];
    const randomPrefix = prefix[Math.floor(Math.random() * prefix.length)];
    const randomNum = Math.floor(Math.random() * 10000);
    const user_login = `${randomPrefix}${randomNum}`;
    
    // 生成真实姓名
    const familyName = familyNames[Math.floor(Math.random() * familyNames.length)];
    const isMale = Math.random() > 0.5;
    const givenName = isMale 
      ? maleNames[Math.floor(Math.random() * maleNames.length)] 
      : femaleNames[Math.floor(Math.random() * femaleNames.length)];
    
    // 30%的概率生成两个字的名字
    let user_name = familyName + givenName;
    if (Math.random() < 0.3) {
      const secondGivenName = isMale 
        ? maleNames[Math.floor(Math.random() * maleNames.length)]
        : femaleNames[Math.floor(Math.random() * femaleNames.length)];
      // 确保两个字不一样
      if (secondGivenName !== givenName) {
        user_name = familyName + givenName + secondGivenName;
      }
    }
    
    // 生成随机头像URL
    const avatarType = avatarUrls[Math.floor(Math.random() * avatarUrls.length)];
    const image = `${avatarType}${user_name}`;
    
    // 生成操作按钮
    const operations = operationsList[Math.floor(Math.random() * operationsList.length)];
    
    data.push({
      id: i,
      entpname,
      user_login,
      user_name,
      image,
      operations
    });
  }
  console.log("获取数据源");
  console.log(data);
  
   mockData.value = await data;  

}



// 生成100条数据
// const mockData = generateMockData(100);
generateMockData(100) 








export default { 
    mockData,
    tColumnConfig,
    slotName
}